package sy.service.impl;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.apache.log4j.Logger;

import sy.dao.SysUserDaoI;
import sy.model.PerAddress;
import sy.model.SysInformation;
import sy.model.SysProject;
import sy.model.SysProjectInformationMapping;
import sy.model.SysUnit;
import sy.model.SysUser;
import sy.model.SysUserUnitMapping;
import sy.service.SysUnitServiceI;
import sy.service.SysUserServiceI;
import sy.service.SysUserUnitMappingServiceI;
import sy.util.ResultJson;

@Service("sysUserService")
public class SysUserServiceImpl implements SysUserServiceI {
	
	private static final Logger logger = Logger.getLogger(SysUser.class);
	private SysUserDaoI sysUserDao;
	@Autowired
	private SysUserUnitMappingServiceI sysUserUnitMappingService;
	@Autowired
	private SysUnitServiceI sysUnitService;


	public SysUserDaoI getSysUserDao() {
		return sysUserDao;
	}

	@Autowired
	public void setSysUserDao(SysUserDaoI sysUserDao) {
		this.sysUserDao = sysUserDao;
	}

	@Override
	public Serializable save(SysUser sysUser) {
		
		return sysUserDao.save(sysUser);
	}

	@Override
	public void remove(String[] ids) {
		// TODO Auto-generated method stub
		for (int i = 0; i < ids.length; i++) {
			SysUser sysUser =	sysUserDao.getSysUserById(ids[i]);
			sysUserDao.remove(sysUser);
		}	
	}

	/* (non-Javadoc)
	 * @see sy.service.SysUserServiceI#update(sy.model.SysUser)
	 */
	@Override
	public void update(SysUser sysUser,String[] unitIds) {
		sysUserDao.update(sysUser);
	}

	/* (non-Javadoc)
	 * @see sy.service.SysUserServiceI#list()
	 */
	@Override
	public List<SysUser> list() {
		// TODO Auto-generated method stub
		return sysUserDao.list();
	}

	/* (non-Javadoc)
	 * @see sy.service.SysUserServiceI#getSysUserById(java.lang.String)
	 */
	@Override
	public SysUser getSysUserById(String id) {
		// TODO Auto-generated method stub
		return sysUserDao.getSysUserById(id);
	}

	/* (non-Javadoc)
	 * @see sy.service.SysUserServiceI#listSysUserByKey(java.lang.String)
	 */
	@Override
	public List<SysUser> listSysUserByKey(String key) {
		return sysUserDao.listSysUserByKey(key);
	}

	@Override
	public List<SysUser> listSysUserByOwnerId(String ownerId) {
		return sysUserDao.listSysUserByOwnerId(ownerId);
	}

	@Override
	public SysUser getSysUserByAccount(String accountId) {
		return sysUserDao.getSysUserByAccount(accountId);
	}

	@Override
	public SysUser getSysUserByName(String name) {
		// TODO Auto-generated method stub
		return sysUserDao.getSysUserByName(name);
	}

	@Override
	public List<SysUser> listSysUserByAccountIds(List<String> accountIds) {
		// TODO Auto-generated method stub
		return sysUserDao.listSysUserByAccountIds(accountIds);
	}

}
